1. Field of the Invention
This invention relates to an information processing method and apparatus for drawing a three-dimensional scene using a computer graphics technique.
2. Description of the Related Art
In a method for drawing a three-dimensional scene in computer graphics, a surface pattern is prepared as texture data, which is mapped onto shape data of a three-dimensional scene. An image obtained by photographing a natural image can be used as the texture data.
Conventionally, when using a photographed natural image as texture data in the above-described manner, the texture data is generated according to the following two methods.
(1) An image is photographed by being adjusted to the shape and the size of an image to be used as texture data, to obtain a texture original image, and points (vertices or the like) corresponding to the shape of a portion where the image is to be mapped are set in the texture original image. Then, an image is mapped by making the points provided in the texture original image correspond to points in that portion.
(2) A desired regtangle is set in a texture original image obtained by photographing an image, and a necessary rectangular region is segmented from the texture original image. The segmented rectangular image is used as the texture original image and is mapped according to the same procedures (setting of vertices and pasting) as in the above-described method (1).
However, the above-described conventional methods for generating texture data have the following problems. First, in the method (1), an object to be utilized as a texture must be photographed by being adjusted to the shape and the size of an image to be used as texture data. That is, it is desirable to photograph the image so that the entire object to be utilized as the texture is included and that the image is obtained as large as possible. Hence, a photographing operation cannot be briefly performed. The object to be utilized as the texture must be photographed as large as possible in order to improve reproducibility of details of the texture after image pasting.
When, for example, photographing a flat surface as an object to be utilized as a texture, if the surface is photographed from an oblique direction, a part of the pattern or the like of the surface looks as being streched or distorted in the obtained image. In order to reproduce the details of the shrinked portion, high resolution is required, thereby increasing the amount of texture data. Accordingly, it is desirable to photograph the object from the direction which is perpendicular to the surface, thereby causing difficulty in the photographing operation.
In the method (2), since the necessary region within the texture original image is not always rectangular, there is the possibility that a large amount of unnecessary region remains. Furthermore, when photographing an object to be utilized as a texture from an oblique direction, the same problem as in the method (1) arises.
There is a method in which, when drawing a three-dimensional scene using computer graphics, the shape of a surface is represented using a polygon, and the pattern of the surface is drawn by mapping the texture image onto the polygon. The following method for acquiring a texture image to be used in such computer graphics is generally known.
A portion to be used as a texture image is assigned in the form of a rectangle from a texture original image, and the assigned portion is segmented to provide the texture image. Then, corresponding positions of the texture image are input for respective vertices of a polygon to which the texture image is to be mapped. Processing of mapping the texture image onto the polygon is executed based on information relating to the input positions.
In the above-described conventional method, however, since the texture image is segmented in the form of a rectangle, a large amount of time is required for providing the polygon, to which the texture image is to be mapped, with the positions of respective vertices when the polygon is not a quadrangle. For example, when pasting a part of a texture image segmented in the form of a rectangle shown in FIG. 13(b) to a polygon having vertices a-h shown in FIG. 13(a), the following procedure is necessary. That is, it is necessary to provide the respective vertices a-h (points indicated by black circles) with the normalized coordinate values of corresponding positions axe2x80x2-hxe2x80x2 (positions indicated by black circles) of the texture image within the rectangle. The normalized coordinates are coordinates in which the respective vertices of the rectangle are represented by (0,0), (1,0), (1,1) and (0,1).
As described above, in the above-described conventional method, since the user inputs the coordinate values of corresponding positions in the texture image for respective vertices on the polygon image, a very troublesome operation is required.
The present invention has been made in consideration of he above-described problems.
It is an object of the present invention to provide a texture-data generation method and apparatus in which a photographing operation when preparing a texture original image is simplified, and in which a useless operation when extracting a necessary region from the texture original image is removed (deletion of unnecessary regions).
It is another object of the present invention to provide an information processing method and apparatus in which the position of a point assigned in a polygon image can be automatically correlated with the position of a point assigned in a texture original image including a necessary texture image, and in which an operation of mapping the texture image onto a polygon is facilitated.
It is still another object of the present invention to provide an information processing method and apparatus in which computer graphics data having a texture can be interactively generated from an image appropriately including the region of a polygon without providing a texture image adjusted to the polygon in advance.
According to one aspect, the present invention which achieves these objectives relates to a texture-data generation apparatus for generating texture data to be used for computer graphics, comprising assigning means for assigning a region in a texture original image serving as a base for a texture, generation means for generating quadrangles, each enclosing the region assigned by the assigning means, based on a predetermined rule, extraction means for extracting a quadrangle having a minimum area from among the rectangles generated by the generation means, first transformation means for transforming an image enclosed by the quadrangle extracted by the extraction means into a rectangular image having a desired size, second transformation means for transforming the region assigned by the assigning means into a region in the rectangular image, and output means for outputting the rectangular image obtained by the first transformation means, and information indicating the region obtained by the second transformation means as texture data.
According to another aspect, the present invention which achieves these objectives relates to a texture-data generation method for generating texture data to be used for computer graphics, comprising the steps of assigning a region in a texture original image serving as a base for a texture, generating quadrangles, each enclosing the region assigned in the assigning step, based on a predetermined rule, extracting a quadrangle having a minimum area from among the quadrangles generated in the generating step, transforming an image enclosed by the quadrangle extracted in the extracting step into a rectangular image having a desired size, transforming the region assigned in the assigning step into a region in the rectangular image, and outputting the rectangular image obtained in the first transforming step, and information indicating the region obtained in the second transforming step as texture data.
According to still another aspect, the present invention which achieves these objectives relates to a storage medium for storing a program for controlling a computer, the program comprising a procedure code of an assigning step of assigning a region in a texture original image serving as a base for a texture, a procedure code of an generating step of generating quadrangles, each enclosing the region assigned in the assigning step, based on a predetermined rule, a procedure code of an extracting step of extracting a quadrangle having a minimum area from among the quadrangles generated in the generating step, a procedure code of a first transforming step of transforming an image enclosed by the quadrangle extracted in the extracting step into a rectangular image having a desired size, a procedure code of a second transformating step of transforming the region assigned in the assigning step into a region on the rectangular image, and a procedure code of an outputting step of outputting the rectangular image obtained in the first transforming step, and information indicating the region obtained in the second transforming step as texture data.
According to still another aspect, the present invention which achieves these objectives relates to an information processing apparatus comprising first display means for displaying a polygon image comprising at least one polygon, second display means for displaying a texture original image including a texture image to be used, assigning means for assigning points on the polygons of the polygon image displayed by the first display means, and corresponding points in the texture original image displayed by the second display means, provision means for providing the respective points assigned in the polygon image by the assigning means with position information of the corresponding points in the texture original image, and output means for outputting polygon data comprising the position information of the corresponding points in the texture original image provided for the points on the polygon by the provision means, and the texture original image as data for image drawing.
According to still another aspect, the present invention which achieves these objectives relates to an information processing method comprising the steps of displaying a polygon image comprising at least one polygon, displaying a texture original image including a texture image to be used, assigning points on the polygons of the polygon image displayed in the first displaying step, and corresponding points in the texture original image displayed in the second displaying step, providing the respective points assigned in the polygon image in the assigning step with position information of the corresponding points in the texture original image, and outputting polygon data comprising the position information of the corresponding points in the texture original image provided for the points on the polygons in the providing step, and the texture original image as data for image drawing.
According to still another aspect, the present invention which achieves these objectives relates to a storage medium for storing a program for controlling a computer, the program comprising a procedure code of a first displaying step of displaying a polygon image comprising at least one polygon, a procedure step of a second displaying step of displaying a texture original image including a texture image to be used, a procedure code of an assigning step of assigning points on the polygons of the polygon image displayed in the first displaying step, and corresponding points in the texture original image displayed in the second displaying step, a procedure code of a providing step of providing the respective points assigned in the polygon image in the assigning step with position information of the corresponding points in the texture original image, and a procedure code of an outputting step of outputting polygon data having the position information of the corresponding points in the texture original image provided for the points on the polygon in the providing step, and the texture original image as data for image drawing.
The foregoing and other objects, advantages and features of the present invention will become more apparent from the following detailed description of the preferred embodiments taken in conjunction with the accompanying drawings.